%% print table
clearvars -except Globaloption option 

fID = fopen(['../../results/tables_main/US/pre1946/Table_us_nobreak_preWWII_oneVAR_WAR.tex'], 'w');
load MAT/benchmark_US_before1946.mat

gdebt = gdebt(2:end);
% 1793-1799 french revolution (FR)
mask = find(date >= 1793 & date <= 1799);
fprintf(fID, '\\newcommand{\\preWWIIFRpctoneVARNB}{%4.2f}\n', 100 * mean(surplusgdp(mask)));
pdxpvs = exp(pxbar) .* taxrevgdp' - exp(pxbar) .* spendgdp';
fprintf(fID, '\\newcommand{\\preWWIIFRpdxpvsoneVARNB}{%4.2f}\n', 100 * mean(pdxpvs(mask)));
pdxCFpvs = exp(pxbar + CFT) .* taxrevgdp' - exp(pxbar + CFG) .* spendgdp';
fprintf(fID, '\\newcommand{\\preWWIIFRpdxCFpvsoneVARNB}{%4.2f}\n', 100 * mean(pdxCFpvs(mask)));
fprintf(fID, '\\newcommand{\\preWWIIFRpvsoneVARNB}{%4.2f}\n', 100 * mean(s(mask)));
fprintf(fID, '\\newcommand{\\preWWIIFRdebtgdponeVARNB}{%4.2f}\n', 100 * mean(gdebt(mask)));

% 1812-1815 American War (AW)
mask = find(date >= 1812 & date <= 1815);
fprintf(fID, '\\newcommand{\\preWWIIAWpctoneVARNB}{%4.2f}\n', 100 * mean(surplusgdp(mask)));
fprintf(fID, '\\newcommand{\\preWWIIAWpdxpvsoneVARNB}{%4.2f}\n', 100 * mean(pdxpvs(mask)));
fprintf(fID, '\\newcommand{\\preWWIIAWpdxCFpvsoneVARNB}{%4.2f}\n', 100 * mean(pdxCFpvs(mask)));
fprintf(fID, '\\newcommand{\\preWWIIAWpvsoneVARNB}{%4.2f}\n', 100 * mean(s(mask)));
fprintf(fID, '\\newcommand{\\preWWIIAWdebtgdponeVARNB}{%4.2f}\n', 100 * mean(gdebt(mask)));

% 1861-1865 Civil War (CW)
mask = find(date >= 1861 & date <= 1865);
fprintf(fID, '\\newcommand{\\preWWIICWpctoneVARNB}{%4.2f}\n', 100 * mean(surplusgdp(mask)));
fprintf(fID, '\\newcommand{\\preWWIICWpdxpvsoneVARNB}{%4.2f}\n', 100 * mean(pdxpvs(mask)));
fprintf(fID, '\\newcommand{\\preWWIICWpdxCFpvsoneVARNB}{%4.2f}\n', 100 * mean(pdxCFpvs(mask)));
fprintf(fID, '\\newcommand{\\preWWIICWpvsoneVARNB}{%4.2f}\n', 100 * mean(s(mask)));
fprintf(fID, '\\newcommand{\\preWWIICWdebtgdponeVARNB}{%4.2f}\n', 100 * mean(gdebt(mask)));

fclose(fID);
